#include "guiterm.hpp"
#include <QCheckBox>

LsSettingsWidget::LsSettingsWidget(const LsCommand *settings, FileView *view)
	:QFrame(NULL, Qt::Popup)
{
	setFrameStyle(QFrame::Panel | QFrame::Raised);
	setLineWidth(2);
	
	QVBoxLayout *layout = new QVBoxLayout;
	setLayout(layout);
	
	QCheckBox *detailedView = new QCheckBox("Show detailed list view (-l)");
	detailedView->setChecked(settings->getIsDetailed());
	connect(detailedView, SIGNAL(toggled(bool)), view, SLOT(setDetailed(bool)));
	layout->addWidget(detailedView);
	
	QCheckBox *showHidden = new QCheckBox("Show hidden files (-a)");
	showHidden->setChecked(settings->getShowHidden());
	connect(showHidden, SIGNAL(toggled(bool)), view, SLOT(setShowHidden(bool)));
	layout->addWidget(showHidden);
}

LsSettingsWidget::~LsSettingsWidget()
{
}

void LsSettingsWidget::focusOutEvent(QFocusEvent *event)
{
	hide();
	deleteLater();
}

